home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’93 / Don's Hacks / AppBar Source / AppBarUnit.a < prev    next >
Text File  |  1993-06-18  |  3KB  |  123 lines

  1.  
  2. ;    $Workfile:   AppBarUnit.a  $
  3. ;    $Revision:   1.0  $
  4.  
  5. ;    Some utilities used by the AppBar program
  6.  
  7. ;    © 1993 CE Software, Inc.  All rights reserved.
  8.  
  9. ;    WHEN    WHO        WHAT
  10.  
  11. ;Checked in by Donald Brown, Tuesday, June 25, 1991 4:54:37 PM
  12. ;    Put under pvcs
  13.  
  14. ;Checked in by Donald Brown, Friday, June 19, 1992 1:32:47 PM
  15. ;    New entry for re-pvcsing for 3.x
  16. ;•••••
  17. ;    
  18. ;•••••
  19.  
  20.  
  21.             BLANKS        ON
  22.             STRING        ASIS
  23.             PRINT    OFF
  24.                 INCLUDE     'Traps.a'
  25.                 INCLUDE     'ToolEqu.a'
  26.                 INCLUDE     'QuickEqu.a'
  27.                 INCLUDE     'SysEqu.a'
  28.                 INCLUDE        'ATalkEqu.a'
  29.                 INCLUDE        'PackMacs.a'
  30.                 include     'ShutdownEqu.a'
  31.                 include     'ScriptEqu.a'
  32.                 include        'StandardFile.a'
  33.                 include        'Processes.a'
  34.             PRINT    ON
  35. ;
  36. ;    Function Storage:MyGlobalsPtr; external;
  37. ;
  38. ;    We store some data within ourselves, so we don't have to worry about A5
  39. ;
  40. Storage    proc    export
  41.         lea        TheData,A0
  42.         move.l    A0,4(SP)
  43.         rts
  44. TheData    dcb.b    2048,0
  45. TheInstallProc    dc.l    0
  46. ;
  47. ;    Procedure Hookup; external;
  48. ;    Procedure UnHook; external;
  49. ;
  50. ;    This installs and removes our hooks into the GNEFilter.  The real work is done
  51. ;    in Pascal, this is just some glue to make it work right.
  52. ;
  53. ;    If the TSM Helper init is installed (we find it with Gestalt) we register our call
  54. ;    with them instead of hooking into GNEFilter ourselves.
  55. ;
  56.         export    HookUp,UnHook
  57.         import    myGNEFilter
  58. Hookup
  59.         clr.w    -(SP)        ;See if TSM Helper init is installed
  60.         move.l    #'tsmH',-(SP)
  61.         pea        TheInstallProc
  62.         import    Gestalt
  63.         jsr    Gestalt
  64.         tst.w    (SP)+
  65.         bne.s    @NoHelper        ;if no error, we're already installed somewhere else
  66. ;
  67. ; We're going to call Procedure InstallOne(VAR wp:WindowPtr; whereproc:procptr; DoInstall:integer);
  68. ;
  69.         pea        TheData            ;push pointer to the window pointer
  70.         pea        myGNEFilter
  71.         move.w    #-1,-(SP)        ;install us!
  72.         move.l    TheInstallProc,A0
  73.         jsr        (A0)
  74.         bra.s    @DoneHookup
  75. @NoHelper
  76.         lea        OldHook,A0            ;hook us into GNEFilter
  77.         move.l    jGNEFilter,(A0)
  78.         lea        asmGNEFilter,A0
  79.         move.l    A0,jGNEFilter
  80. @DoneHookup
  81.         rts
  82.  
  83. UnHook
  84.         clr.w    -(SP)        ;See if TSM Helper init is installed
  85.         move.l    #'tsmH',-(SP)
  86.         pea        TheInstallProc
  87.         import    Gestalt
  88.         jsr    Gestalt
  89.         tst.w    (SP)+
  90.         bne.s    @NoHelper        ;if no error, we're already installed somewhere else
  91. ;
  92. ; We're going to call Procedure InstallOne(VAR wp:WindowPtr; whereproc:procptr; DoInstall:integer);
  93. ;
  94.         pea        TheData            ;push pointer to the window pointer
  95.         pea        myGNEFilter
  96.         clr.w    -(SP)        ;remove us!
  97.         move.l    TheInstallProc,A0
  98.         jsr        (A0)
  99. @NoHelper
  100.         move.l    OldHook,D0            ;make sure we hooked up
  101.         tst.l    D0
  102.         beq.s    @999
  103.         move.l    D0,jGNEFilter
  104.         lea        OldHook,A0
  105.         clr.l    (A0)
  106. @999    rts
  107. ;
  108. asmGNEFilter
  109.         move.l    A1,-(SP)            ;this calls our pascal routine for GNEFilter
  110.         clr.w    -(SP)
  111.         move.w    D0,-(SP)
  112.         move.l    A1,-(SP)
  113.         jsr        myGNEFilter
  114.         move.w    (SP)+,D0
  115.         move.l    (SP)+,A1
  116.         move.w    D0,4(SP)
  117.         move.l    OldHook, A0
  118.         jmp        (A0)
  119.  
  120. OldHook    dc.l    0
  121.         
  122.         end
  123.